*** Create Table 4, 10 and 17 year cohort ***

********************************************************************************

clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** Table 4 focuses on literacy ONLY in Arabic which should not have been impacted by the reform. It reports results for both cohorts ** 

** regressions **

xi: reghdfe Arab_Lit did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LITA_did_BW2_any

drop if YOB > 1955

xi: reghdfe Arab_Lit did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LITA_did_BW1_any


#delimit ; 
estout m_LITA_did_BW1_any
	   m_LITA_did_BW2_any
       using "${output}/tables/Table4.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
	   varlabels(did_edu_ANY "Difference in Differences, education" Female "Female " Arabic "First Language Arabic ")
keep(did_edu_ANY)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of 1950 Reform and European Settlement on Arabic Literacy}        
           \label{tab:DiD_LITA}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering \textbf{Literacy, Arabic} \\ 1945-1955}                     
		   & \multicolumn{1}{p{3cm}}{\centering \textbf{Literacy, Arabic} \\ 1945-1962}                 \\                  
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.7\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
